/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package VISTA.Backing;

import LOGICA.BDLSF.BDL_C_SFDepartamentoBean;
import LOGICA.Beans.BeanLogdepart;
import LOGICA.Beans.BeanLogdistrit;
import LOGICA.Entidades.Logdepart;
import LOGICA.LNSF.LN_C_SFDepartamentoBean;
import LOGICA.LNSF.LN_C_SFDepartamentoBeanRemota;
import LOGICA.LNSF.LN_C_SFDistritoBean;
import LOGICA.LNSF.LN_C_SFDistritoBeanRemota;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
import javax.faces.model.SelectItemGroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 *
 * @author ricardo
 */
@ManagedBean
@Scope("session")
@Component
public class Frm_RegistrarUsuario {
    
    //CONEXCIONES
    @Autowired
    private LN_C_SFDepartamentoBeanRemota ln_C_SFDepartamentoBeanRemota = new LN_C_SFDepartamentoBean();
    @Autowired
    private LN_C_SFDistritoBeanRemota ln_C_SFDistritoBeanRemota = new LN_C_SFDistritoBean();
    @Autowired
    private SessionScopedBeanRegistrarUsuario sessionScopedBeanRegistrarUsuario = new SessionScopedBeanRegistrarUsuario();
    
    
    //VARIABLES
    private String entrada = "";
    
    public Frm_RegistrarUsuario() {
        getSessionScopedBeanRegistrarUsuario().setDepartamentosLst(ln_C_SFDepartamentoBeanRemota.departamentosLst());
    }
    
    public void distritoDepart(){
        String depart = getSessionScopedBeanRegistrarUsuario().getNidDepartamentoSelect();
        if(depart.equals("0")){
            List<BeanLogdistrit> distritos = new ArrayList<BeanLogdistrit>();
            getSessionScopedBeanRegistrarUsuario().setDistritosLst(distritos);
        }else{
            getSessionScopedBeanRegistrarUsuario().setDistritosLst(ln_C_SFDistritoBeanRemota.distritoList(depart));
        }
    }

 
//===================================================================================================================
//Métodos Set y Get
//===================================================================================================================
    public String getEntrada() {
        return entrada;
    }
    public void setEntrada(String entrada) {
        this.entrada = entrada;
    }
    public SessionScopedBeanRegistrarUsuario getSessionScopedBeanRegistrarUsuario() {
        return sessionScopedBeanRegistrarUsuario;
    }
    public void setSessionScopedBeanRegistrarUsuario(SessionScopedBeanRegistrarUsuario sessionScopedBeanRegistrarUsuario) {
        this.sessionScopedBeanRegistrarUsuario = sessionScopedBeanRegistrarUsuario;
    }
}
